package org.opengauss.sqltranslator.translatorenum;

public enum MysqlToPgSqlColumnEnum {
    DATA_TYPE("DATA_TYPE","data_type"),
    CHARACTER_MAXIMUM_LENGTH("CHARACTER_MAXIMUM_LENGTH","character_maximum_length"),
    COLUMN_COMMENT("COLUMN_COMMENT","description"),
    ORDER_ORDINAL_POSITION("ORDINAL_POSITION","sc.table_name,sc.ordinal_position");
    private String mysqlColumnName;
    private String pgsqlColumnName;

    MysqlToPgSqlColumnEnum() {
    }

    MysqlToPgSqlColumnEnum(String mysqlColumnName, String pgsqlColumnName) {
        this.mysqlColumnName = mysqlColumnName;
        this.pgsqlColumnName = pgsqlColumnName;
    }

    public String getMysqlColumnName() {
        return mysqlColumnName;
    }

    public void setMysqlColumnName(String mysqlColumnName) {
        this.mysqlColumnName = mysqlColumnName;
    }

    public String getPgsqlColumnName() {
        return pgsqlColumnName;
    }

    public void setPgsqlColumnName(String pgsqlColumnName) {
        this.pgsqlColumnName = pgsqlColumnName;
    }

    public static MysqlToPgSqlColumnEnum getByMysqlColumnName(String  mysqlColumnName) {
        for (MysqlToPgSqlColumnEnum column : MysqlToPgSqlColumnEnum.values()) {
            if (column.getMysqlColumnName().equals(mysqlColumnName)) {
                return column;
            }
        }
        return null;
    }
}
